package com.flca.frw.dao;

import java.io.Serializable;


/**
 *  Interface that is returned by the ConnPoolMgr and is used in the generated service impl
 *  
 * @author rbakkerus
 *
 */
public interface Dao  extends Serializable {

	/**
	 * Returns the EntityManager in case of JPA the ObjectManager or in case of an OO dbs like Perst, Berkeley Cache etc. 
	 * You should use the corresponding DaoXxx class to get the acutal manager, this will cast to the corresponding object, thus:
	 * DaoJpa.getEntityManager -> javax.EntityManager
	 * DaoPerst.getObjectManager -> 
	 * DaoBerkeley.getObjectManager ->
	 * DaoAppEngine.getObjectManager ->
	 * DaoCache.getObjectManager ->
	 * @return
	 */
	public Object getObjectMgr();

	
	/**
	 * returns true/false to indicate if this connection is already within a transaction
	 * @return
	 * @throws Exception
	 */
	public boolean isInTransaction() throws Exception ;
	
	/**
	 * commits this transaction
	 * @throws Exception
	 */
	public void commit() throws Exception;
	
	/**
	 * rolls back  this transaction
	 * @throws Exception
	 */
	public void rollback() throws Exception;
	
	/** 
	 * start a transaction
	 * @throws Exception
	 */
	public void startTransaction() throws Exception;
	
	/**
	 * returns the persistence type
	 * @return
	 */
	public PersistenceType technology(); 

}
